const RecommendService = require("../service/recommendService");
const { internalServerError } = require("../constant/error");
class RecommendController {
  async findAll(ctx) {
    try {
      const { pageNum = 1, pageSize = 10 } = ctx.request.query;
      const res = await RecommendService.findGoods(pageNum, pageSize);

      ctx.body = {
        code: 0,
        msg: "获取推荐商品列表成功",
        result: res,
      };
    } catch (error) {
      console.error("获取推荐列表错误:", error);
      return ctx.app.emit("error", internalServerError, ctx);
    }
  }
}

module.exports = new RecommendController();